/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;

import MYSQLConection.OperacionesDB;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import Modelo.Persona;

/**
 *
 * @author Adrian
 */
public class DaoPersona {

    private static DaoPersona instance;

    private DaoPersona() {
    }

    public static DaoPersona getInstance() {
        if (instance == null) {
            return instance = new DaoPersona();
        }
        return instance;
    }

    public Persona BuscarPersona(String cedula) throws SQLException {
        OperacionesDB db = new OperacionesDB();
        int cont = 0;
        String query = "select * from persona where cedula='" + cedula + "'";
        ResultSet resultado = db.seleccion(query);
        Persona user = null;
        while (resultado.next()) {
            user = new Persona(resultado.getString(1), resultado.getString(2), resultado.getString(3), resultado.getString(4));
        }
        db.cerrarConexion();
        return user;
    }
}
